<?php
Yii::import("application.libs.*");
Yii::import("application.libs.Zend.Amf.Server",true);
//Yii::import("application.components.YiiAmfServer",true);

class AmfController extends Controller
{
	/**
	 * This is the default 'index' action that is invoked
	 * when an action is not explicitly requested by users.
	 */
	public function actionIndex()
	{
		
		$server = new Zend_Amf_Server();
		$server->setProduction(false);
		
		print_r($server->getRequest());
		
		$server->setClass('YiiAmfServer');
		
		$response=$server->handle();
		//echo $response;
	}

	/**
	 * This is the action to handle external exceptions.
	 */
	public function actionError()
	{
		if($error=Yii::app()->errorHandler->error)
		{
			if(Yii::app()->request->isAjaxRequest)
				echo $error['message'];
			else
				$this->render('error', $error);
		}
	}
}